1 using System;
2 using
System.Collections;
3 using
System.Configuration;
4 using
System.Data;
5 using
System.Linq;
6 using
System.Web;
7 using
System.Web.Security;
8 using
System.Web.UI;
9 using
System.Web.UI.HtmlControls;
10 using
System.Web.UI.WebControls;
11 using
System.Web.UI.WebControls.WebParts;
12 using
System.Xml.Linq;
13
14 public
partial class dangnhap : System.Web.UI.Page
15 {
16     
protected void Page_Load(object sender, EventArgs e)
17     {
18
19     }
20     
protected void btndangnhap_Click(object sender, EventArgs e)
21     {
22         ado.ketNoi();
23         
string query = "select * from tbluser where email='" + txtemail.Text + "' and matkhau='" + txtpass.Text + "'";
24         ado.rd = ado.getData(query);
25         
if (ado.rd.Read())
26         {
27             FormsAuthentication.SetAuthCookie(txtemail.Text,
true);
28             Session[
"email"] = txtemail.Text;
29             Session[
"matkhau"] = ado.rd[1].ToString();
30             Session[
"quyen"] = ado.rd[2].ToString();
31             Session[
"hoten"] = ado.rd[3].ToString();
32             Session[
"diachi"] = ado.rd[4].ToString();
33             Session[
"dienthoai"] = ado.rd[5].ToString();
34             Session[
"soCMND"] = ado.rd[6].ToString();
35             Session[
"mataikhoan"] = ado.rd[7].ToString();
36             
if (Session["dn"] == "kk")
37             {
38                 Response.Redirect(
"thanhtoan.aspx");
39             }
40             
if (Session["quyen"].ToString() == "admin")
41                 Response.Redirect(
"themqtri.aspx");
42             
else
43                 Response.Redirect(
"thongtintaikhoan.aspx", true);
44         }
45         
else
46         {
47             txtemail.Focus();
48         }
49
50         ado.rd.Dispose();
51         ado.dongKetNoi();
52         
53     }
54 }



Quản lý website giới thiệu và bán điện thoại di động ASP.net 19.308 lượt xem

Gõ tìm kiếm nhanh...